package com.jd.jdmall.utils;

import android.widget.Toast;

import com.jd.jdmall.JDApplication;


/**
 * Created by Administrator on 2017/2/4 0004.
 * Toast工具类
 */

public class ToastUtil {
    private static Toast toast;
    // 根据文本显示toast
    public static void  show( String text){
        if(toast==null){
            toast=Toast.makeText(JDApplication.getmContext(),text,Toast.LENGTH_SHORT);
        }
        toast.setText(text);
        toast.show();
    }

    // 根据传入的字符串的id输出相应的字符串
    public static void  show( int textRes){
        if(toast==null){
            toast=Toast.makeText(JDApplication.getmContext(),textRes,Toast.LENGTH_SHORT);
        }
        toast.setText(textRes);
        toast.show();
    }
}
